{extend name="public:base"/}


{block name="title"}新增商品规格{/block}
{block name="style"}{/block}

{block name="main"}

<section class="content" xmlns="http://www.w3.org/1999/html">
    <div class="row">

        <div class="col-md-12">

            <div class="row">
                <div class="col-lg-12">
                    <div class="box">
                        <div class="box-header with-border">
                            <h3 class="box-title">新增商品规格</h3>
                        </div>
                        <form  id="pt_form" method="post">
                            <div class="box-body">

                                <div class="clearfix"></div>

     
                                <div class="form-group required">
                                    <div class='col-sm-2 text-right'>
                                        <label for="name" class="control-label Validform_label" >规格名称</label>
                                    </div>
                                    <div class='col-sm-10'>
                                        <input type="text" id="name" class="form-control" name="name" placeholder="请输入规格名称" datatype="s2-55" nullmsg="请填写规格名称">
                                        <div class="help-block"></div>
                                    </div>
                                </div>
          
                                <div class="form-group ">
                                    <div class='col-sm-2 text-right'>
                                        <label class="control-label" for="type_id">商品模型</label>
                                    </div>
                                    <div class='col-sm-10'>
                                        <select id="type_id" class="form-control" name="type_id">
                                            <option value="0">请选择</option>
                                            <?php if(!empty($goodsType)){foreach($goodsType as $k=>$v){?>
                                            <option value="<?=$v['id']?>"><?=$v['type_name']?></option>
                                            <?php }}?>
                                        </select>
                                        <div class="help-block"></div>
                                    </div>
                                </div>
     
                                <div class="form-group " >
                                    <div class="col-sm-2 text-right">
                                        <label class="control-label Validform_label">能否进行检索                                                        </label>
                                    </div>

                                    <div class="col-sm-10">
                                        <div>
                                            <span style="color:#636f7a">
                                                <input type="radio" name="search_index" value="0" datatype="*"  nullmsg="请选择是否筛选" checked="checked">不需要检索 </span>

                                            
                                            <span style="color:#636f7a">
                                                <input type="radio" name="search_index" value="1">关键字检索</span>
                                        </div>

                                        <div class="help-block"></div>
                                    </div>
                                </div>

     
                                <div class="form-group ">
                                    <div class='col-sm-2 text-right'>
                                        <label for="order" class="control-label Validform_label" >排序</label>
                                    </div>
                                    <div class='col-sm-10'>
                                        <input type="text" id="order" class="form-control" name="order" placeholder="请输入排序数字" datatype="n" ignore="ignore"  nullmsg="请填写排序数字" value="0">
                                        <div class="help-block"></div>
                                    </div>
                                </div>

                                <div class="form-group ">
                                    <div class='col-sm-2 text-right'>
                                        <label for="order" class="control-label Validform_label">规格项</label>
                                    </div>
                                    <div class='col-sm-10'>
                                        <table>

                                        </table>
                                        <div class="spec_item" id="position">
                                            <a href="javascript:void(0);" id="addgroup"><i class="icon ion-android-add-circle"></i> 新增规格项</a>

                                        </div>
                                        <div class="help-block"></div>
                                    </div>
                                </div>

                            </div>
                            <div class="box-footer text-center">
                                <button class="btn btn-primary" type="submit">保存</button>
                                <span class="btn btn-white" onclick="history.go(-1)">返回</span>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
{/block}

{block name="js"}
<script>

    var validate = validator('#pt_form');

    $('#addgroup').click(function(){
        var html = '<tr style="margin-bottom:10px;display:block;">';
        html += '<td><input type="text" class="form-control" name="specItem[]" datatype="*" placeholder="请填写规格值" nullmsg="规格项不能为空"></td>';
        html += '<td style="padding-left:10px;">  <a href="javascript:;" onclick="$(this).parent().parent().remove()"> <i class="icon ion-android-cancel"></i></a></td>';
        html += '<td colspan="3"></td>';
        html += '</tr>';
        $('#position').prev().append(html);
    })

</script>
{/block}